<template>
  <el-table :data="formData" style="width: 100%;" :header-cell-style="{ background: '#f2f2f2', color: '#333', fontWeight: 600, }">
    <el-table-column label="设备编号" align="center">
      <template slot-scope="scope">{{ scope.row.name == null ? '--' : scope.row.name }}</template>
    </el-table-column>
    <el-table-column label="序列号" align="center">
      <template slot-scope="scope"> {{ scope.row.xid == '' ? '--' : scope.row.xid }} </template>
    </el-table-column>
    <el-table-column label="型号" align="center">
      <template slot-scope="scope">  {{ scope.row.shemodel == null ? '--' : scope.row.shemodel }} </template>
    </el-table-column>
    <el-table-column prop="course" label="可用容量/总量" align="center">
      <template slot-scope="scope">{{ scope.row.course == null ? '--' : scope.row.course }} / {{ scope.row.capacity == null ? '--' : scope.row.capacity }}</template>
    </el-table-column>
    <el-table-column prop="status" label="状态" align="center">
      <template slot-scope="scope">
        <span class="scope_zc">{{ scope.row.status == 1 ? '• 正常' : '' }}</span>
        <span class="scope_xz">{{ scope.row.status == 2 ? '• 限制' : '' }}</span>
      </template>
    </el-table-column>
    <el-table-column label="添加时间" align="center">
      <template slot-scope="scope">{{ scope.row.createDate == null ? '--' : scope.row.createDate }}</template>
    </el-table-column>
    <el-table-column label="操作" align="center">
      <template slot-scope="scope">
        <el-button
          type="text"
          @click="handleData(scope.$index, scope.row, 'details')"
          >详情</el-button
        >
        <el-button
          type="text"
          @click="handleData(scope.$index, scope.row, 'limit')"
          >限制</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  props: {
    formData: {
      type: Array,
      default: null,
    },
  },
  methods: {
    handleData(index, row, val) {
      this.$emit('allChange', index, row, val);
    },
  },
};
</script>


<style scoped>
.scope_zc{
  font-weight: 700;
  color: #70b603;
}
.scope_xz{
  font-weight: 700;
  color: #7f7f7f;
}
</style>
